package com.yj;

import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.util.concurrent.atomic.AtomicInteger;

public class DemoJob1 extends QuartzJobBean {
    private Logger logger = LoggerFactory.getLogger(getClass());
    private final AtomicInteger counts = new AtomicInteger();
    @Autowired
    private DemoService demoService;
    @Override
    protected void executeInternal(JobExecutionContext context) {
        logger.info("[DemoJob1][定时第 ({}) 次执行, demoService执行结果为 ({})]",
                counts.incrementAndGet(), demoService.get());
    }
}
